<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template cached_node_allocator</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../interprocess/indexes_reference.html#header.boost.interprocess.allocators.cached_node_allocator_hpp" title="Header &lt;boost/interprocess/allocators/cached_node_allocator.hpp&gt;">
<link rel="prev" href="operator___idm24676.html" title="Function template operator!=">
<link rel="next" href="cached_node_allocator/rebind.html" title="Struct template rebind">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="operator___idm24676.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#header.boost.interprocess.allocators.cached_node_allocator_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="cached_node_allocator/rebind.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.interprocess.cached_node_allocator"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template cached_node_allocator</span></h2>
<p>boost::interprocess::cached_node_allocator</p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../interprocess/indexes_reference.html#header.boost.interprocess.allocators.cached_node_allocator_hpp" title="Header &lt;boost/interprocess/allocators/cached_node_allocator.hpp&gt;">boost/interprocess/allocators/cached_node_allocator.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> SegmentManager<span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> NodesPerBlock<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">segment_manager</span> <a name="boost.interprocess.cached_node_allocator.segment_manager"></a><span class="identifier">segment_manager</span><span class="special">;</span>
  <span class="keyword">typedef</span> <span class="identifier">segment_manager</span><span class="special">::</span><span class="identifier">void_pointer</span>           <a name="boost.interprocess.cached_node_allocator.void_pointer"></a><span class="identifier">void_pointer</span><span class="special">;</span>   
  <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">pointer</span>         <a name="boost.interprocess.cached_node_allocator.pointer"></a><span class="identifier">pointer</span><span class="special">;</span>        
  <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">const_pointer</span>   <a name="boost.interprocess.cached_node_allocator.const_pointer"></a><span class="identifier">const_pointer</span><span class="special">;</span>  
  <span class="keyword">typedef</span> <span class="identifier">T</span>                                       <a name="boost.interprocess.cached_node_allocator.value_type"></a><span class="identifier">value_type</span><span class="special">;</span>     
  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span>                             <a name="boost.interprocess.cached_node_allocator.reference"></a><span class="identifier">reference</span><span class="special">;</span>      
  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span>                             <a name="boost.interprocess.cached_node_allocator.const_reference"></a><span class="identifier">const_reference</span><span class="special">;</span>
  <span class="keyword">typedef</span> <span class="identifier">SegmentManager</span><span class="special">::</span><span class="identifier">size_type</span>               <a name="boost.interprocess.cached_node_allocator.size_type"></a><span class="identifier">size_type</span><span class="special">;</span>      
  <span class="keyword">typedef</span> <span class="identifier">SegmentManager</span><span class="special">::</span><span class="identifier">difference_type</span>         <a name="boost.interprocess.cached_node_allocator.difference_type"></a><span class="identifier">difference_type</span><span class="special">;</span>

  <span class="comment">// member classes/structs/unions</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T2<span class="special">&gt;</span> 
  <span class="keyword">struct</span> <a class="link" href="cached_node_allocator/rebind.html" title="Struct template rebind">rebind</a> <span class="special">{</span>
    <span class="comment">// types</span>
    <span class="keyword">typedef</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a><span class="special">&lt;</span> <span class="identifier">T2</span><span class="special">,</span> <span class="identifier">SegmentManager</span> <span class="special">&gt;</span> <a class="link" href="cached_node_allocator/rebind.html#boost.interprocess.cached_node_allocator.rebind.other"><span class="identifier">other</span></a><span class="special">;</span>
  <span class="special">}</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="cached_node_allocator.html#boost.interprocess.cached_node_allocatorconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="cached_node_allocator.html#idm24896-bb"><span class="identifier">cached_node_allocator</span></a><span class="special">(</span><span class="identifier">segment_manager</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="../container/stable_vector.html#idm24902-bb"><span class="identifier">cached_node_allocator</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T2<span class="special">&gt;</span> 
    <a class="link" href="cached_node_allocator.html#idm24909-bb"><span class="identifier">cached_node_allocator</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a><span class="special">&lt;</span> <span class="identifier">T2</span><span class="special">,</span> <span class="identifier">SegmentManager</span><span class="special">,</span> <span class="identifier">NodesPerBlock</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T2<span class="special">,</span> <span class="keyword">typename</span> SegmentManager2<span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> N2<span class="special">&gt;</span> 
    <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a> <span class="special">&amp;</span> 
    <a class="link" href="cached_node_allocator.html#idm24737-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a><span class="special">&lt;</span> <span class="identifier">T2</span><span class="special">,</span> <span class="identifier">SegmentManager2</span><span class="special">,</span> <span class="identifier">N2</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a> <span class="special">&amp;</span> <a class="link" href="cached_node_allocator.html#idm24751-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="cached_node_allocator.html#idm24919-bb"><span class="special">~</span><span class="identifier">cached_node_allocator</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="cached_node_allocator.html#idm24760-bb">public member functions</a></span>
  <span class="identifier">node_pool_t</span> <span class="special">*</span> <a class="link" href="cached_node_allocator.html#idm24761-bb"><span class="identifier">get_node_pool</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">segment_manager</span> <span class="special">*</span> <a class="link" href="cached_node_allocator.html#idm24765-bb"><span class="identifier">get_segment_manager</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">size_type</span> <a class="link" href="cached_node_allocator.html#idm24769-bb"><span class="identifier">max_size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">pointer</span> <a class="link" href="cached_node_allocator.html#idm24773-bb"><span class="identifier">allocate</span></a><span class="special">(</span><span class="identifier">size_type</span><span class="special">,</span> <span class="identifier">cvoid_pointer</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24783-bb"><span class="identifier">deallocate</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24791-bb"><span class="identifier">deallocate_free_blocks</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">pointer</span> <a class="link" href="cached_node_allocator.html#idm24795-bb"><span class="identifier">address</span></a><span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">const_pointer</span> <a class="link" href="cached_node_allocator.html#idm24801-bb"><span class="identifier">address</span></a><span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24807-bb"><span class="identifier">construct</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">const_reference</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24815-bb"><span class="identifier">destroy</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">size_type</span> <a class="link" href="cached_node_allocator.html#idm24821-bb"><span class="identifier">size</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">pointer</span> <a class="link" href="cached_node_allocator.html#idm24827-bb"><span class="identifier">allocation_command</span></a><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">interprocess</span><span class="special">::</span><span class="identifier">allocation_type</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">,</span> 
                             <span class="identifier">size_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">pointer</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24837-bb"><span class="identifier">allocate_many</span></a><span class="special">(</span><span class="identifier">size_type</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">,</span> <span class="identifier">multiallocation_chain</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24847-bb"><span class="identifier">allocate_many</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">size_type</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">,</span> <span class="identifier">multiallocation_chain</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24857-bb"><span class="identifier">deallocate_many</span></a><span class="special">(</span><span class="identifier">multiallocation_chain</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">pointer</span> <a class="link" href="cached_node_allocator.html#idm24863-bb"><span class="identifier">allocate_one</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">multiallocation_chain</span> <a class="link" href="cached_node_allocator.html#idm24868-bb"><span class="identifier">allocate_individual</span></a><span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="../container/stable_vector.html#idm24874-bb"><span class="identifier">deallocate_one</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24880-bb"><span class="identifier">deallocate_individual</span></a><span class="special">(</span><span class="identifier">multiallocation_chain</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24886-bb"><span class="identifier">set_max_cached_nodes</span></a><span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">size_type</span> <a class="link" href="cached_node_allocator.html#idm24892-bb"><span class="identifier">get_max_cached_nodes</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="cached_node_allocator.html#idm24922-bb">friend functions</a></span>
  <span class="keyword">void</span> <a class="link" href="cached_node_allocator.html#idm24923-bb"><span class="identifier">swap</span></a><span class="special">(</span><span class="identifier">self_t</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">self_t</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.17.17.3.5.4.4"></a><h2>Description</h2>
<div class="refsect2">
<a name="id-1.3.17.17.3.5.4.4.2"></a><h3>
<a name="boost.interprocess.cached_node_allocatorconstruct-copy-destruct"></a><code class="computeroutput">cached_node_allocator</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idm24896-bb"></a><span class="identifier">cached_node_allocator</span><span class="special">(</span><span class="identifier">segment_manager</span> <span class="special">*</span> segment_mngr<span class="special">)</span><span class="special">;</span></pre>
<p>Constructor from a segment manager. If not present, constructs a node pool. Increments the reference count of the associated node pool. Can throw <code class="computeroutput"><a class="link" href="bad_alloc.html" title="Class bad_alloc">boost::interprocess::bad_alloc</a></code> </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idm24902-bb"></a><span class="identifier">cached_node_allocator</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a> <span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<p>Copy constructor from other <code class="computeroutput"><a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a></code>. Increments the reference count of the associated node pool. Never throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T2<span class="special">&gt;</span> 
  <a name="idm24909-bb"></a><span class="identifier">cached_node_allocator</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a><span class="special">&lt;</span> <span class="identifier">T2</span><span class="special">,</span> <span class="identifier">SegmentManager</span><span class="special">,</span> <span class="identifier">NodesPerBlock</span> <span class="special">&gt;</span> <span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<p>Copy constructor from related <code class="computeroutput"><a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a></code>. If not present, constructs a node pool. Increments the reference count of the associated node pool. Can throw <code class="computeroutput"><a class="link" href="bad_alloc.html" title="Class bad_alloc">boost::interprocess::bad_alloc</a></code> </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T2<span class="special">,</span> <span class="keyword">typename</span> SegmentManager2<span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> N2<span class="special">&gt;</span> 
  <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a> <span class="special">&amp;</span> 
  <a name="idm24737-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a><span class="special">&lt;</span> <span class="identifier">T2</span><span class="special">,</span> <span class="identifier">SegmentManager2</span><span class="special">,</span> <span class="identifier">N2</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>
<p>Not assignable from related <code class="computeroutput"><a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a></code> </p>
</li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a> <span class="special">&amp;</span> <a name="idm24751-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>
<p>Not assignable from other <code class="computeroutput"><a class="link" href="cached_node_allocator.html" title="Class template cached_node_allocator">cached_node_allocator</a></code> </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idm24919-bb"></a><span class="special">~</span><span class="identifier">cached_node_allocator</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Destructor, removes node_pool_t from memory if its reference count reaches to zero. Never throws </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.17.17.3.5.4.4.3"></a><h3>
<a name="idm24760-bb"></a><code class="computeroutput">cached_node_allocator</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="identifier">node_pool_t</span> <span class="special">*</span> <a name="idm24761-bb"></a><span class="identifier">get_node_pool</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a pointer to the node pool. Never throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">segment_manager</span> <span class="special">*</span> <a name="idm24765-bb"></a><span class="identifier">get_segment_manager</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the segment manager. Never throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">size_type</span> <a name="idm24769-bb"></a><span class="identifier">max_size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the number of elements that could be allocated. Never throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">pointer</span> <a name="idm24773-bb"></a><span class="identifier">allocate</span><span class="special">(</span><span class="identifier">size_type</span> count<span class="special">,</span> <span class="identifier">cvoid_pointer</span> hint <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span></pre>
<p>Allocate memory for an array of count elements. Throws <code class="computeroutput"><a class="link" href="bad_alloc.html" title="Class bad_alloc">boost::interprocess::bad_alloc</a></code> if there is no enough memory </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24783-bb"></a><span class="identifier">deallocate</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span> ptr<span class="special">,</span> <span class="identifier">size_type</span> count<span class="special">)</span><span class="special">;</span></pre>
<p>Deallocate allocated memory. Never throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24791-bb"></a><span class="identifier">deallocate_free_blocks</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Deallocates all free blocks of the pool </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">pointer</span> <a name="idm24795-bb"></a><span class="identifier">address</span><span class="special">(</span><span class="identifier">reference</span> value<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns address of mutable object. Never throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">const_pointer</span> <a name="idm24801-bb"></a><span class="identifier">address</span><span class="special">(</span><span class="identifier">const_reference</span> value<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns address of non mutable object. Never throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24807-bb"></a><span class="identifier">construct</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span> ptr<span class="special">,</span> <span class="identifier">const_reference</span> v<span class="special">)</span><span class="special">;</span></pre>
<p>Default construct an object. Throws if T's default constructor throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24815-bb"></a><span class="identifier">destroy</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span> ptr<span class="special">)</span><span class="special">;</span></pre>
<p>Destroys object. Throws if object's destructor throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">size_type</span> <a name="idm24821-bb"></a><span class="identifier">size</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span> p<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns maximum the number of objects the previously allocated memory pointed by p can hold. This size only works for memory allocated with allocate, allocation_command and allocate_many. </p>
</li>
<li class="listitem"><pre class="literallayout"><span class="identifier">pointer</span> <a name="idm24827-bb"></a><span class="identifier">allocation_command</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">interprocess</span><span class="special">::</span><span class="identifier">allocation_type</span> command<span class="special">,</span> 
                           <span class="identifier">size_type</span> limit_size<span class="special">,</span> 
                           <span class="identifier">size_type</span> <span class="special">&amp;</span> prefer_in_recvd_out_size<span class="special">,</span> 
                           <span class="identifier">pointer</span> <span class="special">&amp;</span> reuse<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24837-bb"></a><span class="identifier">allocate_many</span><span class="special">(</span><span class="identifier">size_type</span> elem_size<span class="special">,</span> <span class="identifier">size_type</span> num_elements<span class="special">,</span> 
                   <span class="identifier">multiallocation_chain</span> <span class="special">&amp;</span> chain<span class="special">)</span><span class="special">;</span></pre>
<p>Allocates many elements of size elem_size in a contiguous block of memory. The minimum number to be allocated is min_elements, the preferred and maximum number is preferred_elements. The number of actually allocated elements is will be assigned to received_size. The elements must be deallocated with deallocate(...) </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24847-bb"></a><span class="identifier">allocate_many</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">size_type</span> <span class="special">*</span> elem_sizes<span class="special">,</span> <span class="identifier">size_type</span> n_elements<span class="special">,</span> 
                   <span class="identifier">multiallocation_chain</span> <span class="special">&amp;</span> chain<span class="special">)</span><span class="special">;</span></pre>
<p>Allocates n_elements elements, each one of size elem_sizes[i]in a contiguous block of memory. The elements must be deallocated </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24857-bb"></a><span class="identifier">deallocate_many</span><span class="special">(</span><span class="identifier">multiallocation_chain</span> <span class="special">&amp;</span> chain<span class="special">)</span><span class="special">;</span></pre>
<p>Allocates many elements of size elem_size in a contiguous block of memory. The minimum number to be allocated is min_elements, the preferred and maximum number is preferred_elements. The number of actually allocated elements is will be assigned to received_size. The elements must be deallocated with deallocate(...) </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">pointer</span> <a name="idm24863-bb"></a><span class="identifier">allocate_one</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Allocates just one object. Memory allocated with this function must be deallocated only with deallocate_one(). Throws <code class="computeroutput"><a class="link" href="bad_alloc.html" title="Class bad_alloc">boost::interprocess::bad_alloc</a></code> if there is no enough memory </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">multiallocation_chain</span> <a name="idm24868-bb"></a><span class="identifier">allocate_individual</span><span class="special">(</span><span class="identifier">size_type</span> num_elements<span class="special">)</span><span class="special">;</span></pre>
<p>Allocates many elements of size == 1 in a contiguous block of memory. The minimum number to be allocated is min_elements, the preferred and maximum number is preferred_elements. The number of actually allocated elements is will be assigned to received_size. Memory allocated with this function must be deallocated only with deallocate_one(). </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24874-bb"></a><span class="identifier">deallocate_one</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pointer</span> <span class="special">&amp;</span> p<span class="special">)</span><span class="special">;</span></pre>
<p>Deallocates memory previously allocated with allocate_one(). You should never use deallocate_one to deallocate memory allocated with other functions different from allocate_one(). Never throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24880-bb"></a><span class="identifier">deallocate_individual</span><span class="special">(</span><span class="identifier">multiallocation_chain</span> it<span class="special">)</span><span class="special">;</span></pre>
<p>Allocates many elements of size == 1 in a contiguous block of memory. The minimum number to be allocated is min_elements, the preferred and maximum number is preferred_elements. The number of actually allocated elements is will be assigned to received_size. Memory allocated with this function must be deallocated only with deallocate_one(). </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24886-bb"></a><span class="identifier">set_max_cached_nodes</span><span class="special">(</span><span class="identifier">size_type</span> newmax<span class="special">)</span><span class="special">;</span></pre>
<p>Sets the new max cached nodes value. This can provoke deallocations if "newmax" is less than current cached nodes. Never throws </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">size_type</span> <a name="idm24892-bb"></a><span class="identifier">get_max_cached_nodes</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the max cached nodes parameter. Never throws </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.17.17.3.5.4.4.4"></a><h3>
<a name="idm24922-bb"></a><code class="computeroutput">cached_node_allocator</code> friend functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm24923-bb"></a><span class="identifier">swap</span><span class="special">(</span><span class="identifier">self_t</span> <span class="special">&amp;</span> alloc1<span class="special">,</span> <span class="identifier">self_t</span> <span class="special">&amp;</span> alloc2<span class="special">)</span><span class="special">;</span></pre>
<p>Swaps allocators. Does not throw. If each allocator is placed in a different memory segment, the result is undefined. </p>
</li></ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2005-2015 Ion Gaztanaga<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="operator___idm24676.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#header.boost.interprocess.allocators.cached_node_allocator_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="cached_node_allocator/rebind.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
